import { Navigate } from "react-router-dom";//导入重定向

const IsLogin = (props) => {//封装权限判断
    const Com = props.children.type//获取组件
    const skip = localStorage.getItem('skip');//获取跳过权限的值
    if (skip) {
        return <Com></Com>//渲染组件
    }
    const token = localStorage.getItem('refreshToken');//获取token
    if (token) {
        return <Com></Com>//渲染组件
    } else {
        return <Navigate to='/login'></Navigate>
    }
}

export default IsLogin;//导出权限判断